function StartAjaxAnimate(job) {

  var mySwiper = new Swiper('.swiper-container', {
    //autoplay: 3200, //自动播放间隔时间
    //loop: true,
    initialSlide: 1, //从第2个开始
    //loopAdditionalSlides: 3,
    //pagination: '.swiper-pagination',
    //autoplayDisableOnInteraction: false,
    //observer: true,
    //observeParents: true,
    effect: 'coverflow',
    slidesPerView: 4,
    centeredSlides: true,
    coverflow: {
      rotate: 0,
      stretch: 0,
      depth: 0,
      modifier: 0,
      slideShadows: false
    }
  });


  $('.swiper-slide').click(function () {
    var details = $(this).find('.details');
    $('.details').stop().slideUp(300);
    details.stop().slideToggle(300);
  });
  $('.details').click(function () {
    $(this).stop().slideUp(300);
    event.stopPropagation();
  });
  $('.readerlogin-button,.search').click(function () {
    $('.details').stop().slideUp(300);
  });



}

function StartCustomScripts(job) {

  var loginButton = $('.readerlogin-button');
  var loginForm = $('.readerlogin-form');
  var loginFormError = $('.readerlogin-form .error');
  var loginFormInput = $('.readerlogin-form form input');
  var maskAndclose = $('.readerlogin-form .mask,#close');
  var mask = $('.readerlogin-form .mask');
  var header = $('header h1');

  header.addClass('headernormal');
  loginButton.click(function () {
    if (PatronID > 0) {
      AjaxContents(window.TopicId, window.CurrentFunction, '', JobIDUserInfo, '');
    } else {
      SetCSLNOne("INPUTOFF:");

      loginForm.show();
      header.removeClass('headernormal').addClass('headerlogin');
      mask.fadeIn();
    }
  });

  maskAndclose.click(function () {
    SetCSLNOne("INPUTON:");

    loginForm.hide();
    mask.hide();
    header.removeClass('headerlogin').addClass('headernormal');
    loginFormError.empty(); //清除登录窗口的错误信息
    loginFormInput.val(null); //清除用户名密码
    return false;
  });

}

/*　读者登录 */
$(function () {
  StartCustomScripts("");
});






// 调用视频播放方法，跳转到首页调用一次即可，进入首页20秒后开始播放，点击关闭按钮后等待20秒开始播放
$(function () {
  autoPlayVideo(20);
});

// 视频播放函数
function autoPlayVideo(waitingtime) {
  var closebutton = $('.video .closevideo');
  var playbutton = $('.video .playvideo');
  var video = $('.video video');
  var t;

  autoPlay(playbutton, waitingtime);

  // 点击关闭按钮
  closebutton.click(function () {
    $(this).parent('.video').addClass('video-closed');
    video.trigger('pause');
    document.getElementsByTagName('video')[0].currentTime = 0;
    // 点击关闭按钮后开始倒计时，waitingtime 秒后自动点击播放视频按钮（停留首页未做操作，如果进入了其他，没有视频结构，也不会触发播放视频）
    autoPlay(playbutton, waitingtime);
  });

  // 点击播放视频按钮
  playbutton.click(function () {
    $(this).parent('.video').removeClass('video-closed');
    video.trigger('play');
  });

  // 视频自动播放判断函数
  function autoPlay(playbutton, time) {
    var video = document.getElementsByTagName('video')[0];
    if (video.paused) {
      clearTimeout(t);
      t = setTimeout(function () {
        playbutton.trigger('click');
      }, time * 1000);
    }
    return true;
  }
}

$(function(){
  $('.search input').focus(function(){
    $('.hotwords').stop().slideDown();
  });
  $('.search input').blur(function(){
    $('.hotwords').stop().slideUp();
  });
});
